package 线程.线程池;

import java.lang.reflect.Executable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class 无限的线程池 {
    public static void main(String[] args) {
        //1.创建一个无限的线程池
        ExecutorService pool = Executors.newCachedThreadPool();

        //2.向线程池中放入线程的任务类
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());
        pool.submit(new MyRun());

        //3.销毁线程池
        pool.shutdown();


    }
}
